﻿/*----------------------------------------------------------------
// 公司名称：公司名称
//
// 产品名称：Gaf
//
// 创 建 人：netcasewqs
// 创建日期：2022/3/4
// 邮    箱：netcasewqs@qq.com
//
// Copyright (C) 2022 Gaf，保留所有权利。
//
//----------------------------------------------------------------*/

namespace Gaf;

/// <summary>
/// 
/// </summary>
sealed class Addin : IAddin
{
    /// <summary>
    /// 插件清单配置信息
    /// </summary>
    public IConfiguration? Manifest { get; internal set; }

    /// <summary>
    /// 插件Assembly 
    /// </summary>
    public IEnumerable<Assembly> Assemblies { get; internal set; } = Enumerable.Empty<Assembly>();

    internal List<ServiceDescriptor> _Services = new();
    /// <summary>
    /// 插件导出的服务列表
    /// </summary>
    public IEnumerable<ServiceDescriptor> Services => _Services;
    /// <summary>
    /// 
    /// </summary>
    public int Id { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public string Name { get; set; } = null!;
    /// <summary>
    /// 
    /// </summary>
    public uint StartLevel { get; set; }

    public bool IsLiteAddin { get; internal set; }

    /// <summary>
    /// 
    /// </summary>
    public AddinState State { get; set; }
    /// <summary>
    /// .
    /// </summary>
    public string Location { get; set; } = null!;
    /// <summary>
    /// 
    /// </summary>
    public string? Description { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public string? Version { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public string? Copyright { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public string? Vendor { get; set; }



    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public override string ToString() => $"{Name} [{Id}] [{State}]";
}